import JSONbig from 'json-bigint'
//  病患相关的接口
import request from '@/utils/request'
// 验证图形并获取短信验证码 1
export function getVerfiyCode(data) {
  return request({
    method: 'post',
    url: '/sms/getVerfiyCode',
    data
  })
}
// ok  短信验证码登录 2
export function verfiyCodeLogin(data) {
  return request({
    method: 'post',
    url: '/user/patient/verfiyCodeLogin',
    data
  })
}
//  ok 注册 3
export function register(data) {
  return request({
    method: 'post',
    url: '/user/patient/register',
    data
  })
}
//  ok  获取短信验证码 4
export function verfiyCode(data) {
  return request({
    method: 'post',
    url: '/user/sms/getVerfiyCode',
    data
  })
}
//  ok 用户名密码登录 5
export function login(data) {
  return request({
    method: 'post',
    url: '/user/patient/accountLogin',
    data
  })
}
// ok  修改个人信息 6
export function updatePatientInfo(data) {
  return request({
    method: 'post',
    url: '/user/patient/updatePatientInfo',
    data
  })
}
//  ok 修改更换手机号 7
export function updateMobile(data) {
  return request({
    method: 'post',
    url: '/user/patient/updateMobile',
    data
  })
}
//  ok 修改登录密码 8
export function updatePassword(data) {
  return request({
    method: 'post',
    url: 'user/patient/updatePassword',
    data
  })
}
//  ok 新增亲属信息9
export function insertRelatives(data) {
  return request({
    method: 'post',
    url: 'user/patient/insertRelatives',
    data
  })
}
// ok  获取个人信息及亲属列表10
export function getPatientInfo(query) {
  return request({
    url: '/user/patient/getPatientInfo',
    params: query,
    transformResponse: [function (data) {
      return JSONbig.parse(data);
    }],
  })
}
//  ing 根据亲属id获取亲属信息11
export function getRelativeInfoById(query) {
  return request({
    url: '/user/patient/getRelativesById',
    params: query
  })
}
//  ing 根据亲属id修改亲属信息12
export function updateRelativeInfoById(data) {
  return request({
    method: "post",
    url: '/user/patient/updateRelativesById',
    data
  })
}
//  ok  获取关注医生列表13
export function getFollowDoctorList(query) {
  return request({
    url: '/user/patient/followDoctorList',
    params: query,
    transformResponse: [function (data) {
      return JSONbig.parse(data);
    }],
  })
}
//  ok 退出登录 14
export function logout() {
  return request({
    url: 'user/patient/logout',
  })
}
//  ok 点击关注医生 15
export function followDoctor(data) {
  return request({
    method: "post",
    url: '/user/patient/followDoctor',
    data
  })
}
//  ok 取消关注医生 16
export function delFollowDoctor(data) {
  return request({
    method: "post",
    url: 'user/patient/delFollowDoctor',
    data
  })
}
// ok 获取图形验证码图片 17 
export function getGraphicCode() {
  return request({
    url: '/user/sms/getValidateCode'
  })
}
//  ok 根据医生id获取医生信息18
export function getDoctorInfoById(query) {
  return request({
    url: '/user/patient/getDoctorInfoById',
    params: query
  })
}
//  获取上传头像签名 19
export function uploadImage(query) {
  return request({
    url: '/user/attachment/getSignaturePatLogo',
    params: query
  })
}
//  保存附件信息 20
export function SaveInformation(data) {
  return request({
    method: "post",
    url: '/user/attachment/savePatLogo',
    data
  })
}
//  ok 根据亲属id删除亲属信息 21
export function deleteRelById(query) {
  return request({
    url: '/user/patient/deleteRelById',
    params: query
  })
}
//  地址新增22
export function addAddress(data) {
  return request({
    method: 'post',
    url: '/user/address/insert',
    data
  })
}
//  地址删除23
export function deleteAddressById(query) {
  return request({
    url: '/user/address/deleteById',
    params: query
  })
}
//  地址列表查看24
export function getAddressList(query) {
  return request({
    url: '/user/address/list',
    params: query,
    transformResponse: [function (data) {
      return JSONbig.parse(data);
    }]
  })
}
//  合并
export default {
  getVerfiyCode,
  verfiyCodeLogin,
  register,
  verfiyCode,
  login,
  updatePatientInfo,
  updateMobile,
  updatePassword,
  insertRelatives,
  getPatientInfo,
  getRelativeInfoById,
  updateRelativeInfoById,
  getFollowDoctorList,
  logout,
  followDoctor,
  delFollowDoctor,
  getGraphicCode,
  getDoctorInfoById,
  uploadImage,
  SaveInformation,
  deleteRelById,
  addAddress,
  deleteAddressById,
  getAddressList
}
